﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FilmManagement2.Founction;
using FilmManagement2.Object;
using System.Data;
using System.Data.SqlClient;

namespace FilmManagement2.Founction
{
    public class SeatDetail
    {
        public int getseatOne(int filmid,DateTime dt)
        {
            int seat = 0;
            MovieStudio ms = new MovieStudio();
            ConnectToSql cts = new ConnectToSql();
           DataSet ds=cts.GetStudioOneDetailByIDandStartTime(filmid,dt);
           if (ds.Tables[0].Rows.Count == 0)
           {
               seat = 0;
           }
           else
           {
               ms.AA = Convert.ToBoolean(ds.Tables[0].Rows[0][4]);
               ms.AB = Convert.ToBoolean(ds.Tables[0].Rows[0][5]);
               ms.AC = Convert.ToBoolean(ds.Tables[0].Rows[0][6]);
               ms.BA = Convert.ToBoolean(ds.Tables[0].Rows[0][7]);
               ms.BB = Convert.ToBoolean(ds.Tables[0].Rows[0][8]);
               ms.BC = Convert.ToBoolean(ds.Tables[0].Rows[0][9]);
               ms.CA = Convert.ToBoolean(ds.Tables[0].Rows[0][10]);
               ms.CB = Convert.ToBoolean(ds.Tables[0].Rows[0][11]);
               ms.CC = Convert.ToBoolean(ds.Tables[0].Rows[0][12]);
               seat = ms.getRestSeatNumber();
           }
          return seat;
        }
        public int getseatTwo(int filmid, DateTime dt)
        {
            int seat = 0;
            MovieStudio ms = new MovieStudio();
            ConnectToSql cts = new ConnectToSql();
            DataSet ds = cts.GetStudioTwoDetailByIDandStartTime(filmid, dt);
            if (ds.Tables[0].Rows.Count == 0)
            {
                seat = 0;
            }
            else
            {
                ms.AA = Convert.ToBoolean(ds.Tables[0].Rows[0][4]);
                ms.AB = Convert.ToBoolean(ds.Tables[0].Rows[0][5]);
                ms.AC = Convert.ToBoolean(ds.Tables[0].Rows[0][6]);
                ms.BA = Convert.ToBoolean(ds.Tables[0].Rows[0][7]);
                ms.BB = Convert.ToBoolean(ds.Tables[0].Rows[0][8]);
                ms.BC = Convert.ToBoolean(ds.Tables[0].Rows[0][9]);
                ms.CA = Convert.ToBoolean(ds.Tables[0].Rows[0][10]);
                ms.CB = Convert.ToBoolean(ds.Tables[0].Rows[0][11]);
                ms.CC = Convert.ToBoolean(ds.Tables[0].Rows[0][12]);
                seat = ms.getRestSeatNumber();
            }
            return seat;
        }
        public int getseatThree(int filmid, DateTime dt)
        {
            int seat = 0;
            MovieStudio ms = new MovieStudio();
            ConnectToSql cts = new ConnectToSql();
            DataSet ds = cts.GetStudioThreeDetailByIDandStartTime(filmid, dt);
            if (ds.Tables[0].Rows.Count == 0)
            {
                seat = 0;
            }
            else
            {
                ms.AA = Convert.ToBoolean(ds.Tables[0].Rows[0][4]);
                ms.AB = Convert.ToBoolean(ds.Tables[0].Rows[0][5]);
                ms.AC = Convert.ToBoolean(ds.Tables[0].Rows[0][6]);
                ms.BA = Convert.ToBoolean(ds.Tables[0].Rows[0][7]);
                ms.BB = Convert.ToBoolean(ds.Tables[0].Rows[0][8]);
                ms.BC = Convert.ToBoolean(ds.Tables[0].Rows[0][9]);
                ms.CA = Convert.ToBoolean(ds.Tables[0].Rows[0][10]);
                ms.CB = Convert.ToBoolean(ds.Tables[0].Rows[0][11]);
                ms.CC = Convert.ToBoolean(ds.Tables[0].Rows[0][12]);
                seat = ms.getRestSeatNumber();
            }
            return seat;
        }
       
    }
}